<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:import href="&nx_project_xsl;main.xsl"/>
<xsl:template name="content">

<table width="100%" border="0" cellspacing="0" cellpadding="0">
   <tr>
    <td colspan="2">
        <xsl:if test="user_validation">
            <div class="error">This form is contains errors. <br/>Please check highlighted fields.</div>            
        </xsl:if>
    </td>
  </tr>
  <tr>
    <td>
      <form name="user_add" method="post">
	  <xsl:if test="//_get/user_id">
	  <input type="hidden" name="user_id" value="{//_get/user_id}"/>
	  </xsl:if>
        <table width="100%" border="0" cellspacing="0" cellpadding="3">
          <tr align="center">
            <td colspan="2"><b>User Add/Edit</b></td>
          </tr>

          <tr> 
            <td align="right"><xsl:if test="user_validation/user_name/failed">
                <xsl:attribute name="class">error</xsl:attribute>
                </xsl:if>Username*</td>
            <td>
              <input type="text" name="user_login" value="{_post/user_login|//get_user_by_id/user_login}" size="25"/>
            </td>
          </tr>
          <tr> 
            <td align="right">
                Email*</td>
            <td>
              <input type="text" name="user_email" value="{_post/user_email|//get_user_by_id/user_email}" size="25"/>
            </td>
          </tr>
		  <xsl:if test="not(//get_user_by_id/user_name)">
           <tr> 
            <td align="right">
                <xsl:if test="user_validation/user_password/failed">
                <xsl:attribute name="class">error</xsl:attribute>
                </xsl:if>Password*</td>
            <td>
              <input type="password" name="user_password"  size="25"/>
            </td>
          </tr>
         <tr> 
            <td align="right">Password confirm*</td>
            <td>
              <input type="password" name="user_password_match" size="25"/>
            </td>
          </tr>
		  </xsl:if>
          <tr>
            <td align="right" valign="top">
                <xsl:if test="user_validation/group_id/failed">
                <xsl:attribute name="class">error</xsl:attribute>
                </xsl:if>Groups*</td>
            <td>
              <xsl:for-each select="//group">
                <input type="checkbox" name="group_id[]" value="{group_id}">
                    <xsl:if test="(group_id=//_post/group_id) or (group_id=//get_user_groups_by_id/group_id)">
                        <xsl:attribute name="checked">checked</xsl:attribute>
                    </xsl:if>
                </input>
                    <xsl:value-of select="name"/><br/>
            </xsl:for-each>
            
            </td>
          </tr>
          <tr> 
            <td></td>
            <td align="center">
            <div onclick="document.user_add.submit();">
              <input type="submit" name="submit" value="Submit" id="submit" onclick="javascript:document.getElementById('submit').disabled=true'; "/></div>
            </td>
          </tr>
        </table>
      </form>
    </td>
  </tr>
</table>

</xsl:template>


</xsl:stylesheet>

